package com.chelsea;

import java.util.Scanner;

public class WordsToNumber {
	       public static void main (String [] args){
	               Scanner in = new Scanner(System.in);
	               String input;

	               System.out.print("Please enter a number: ");
	               input = in.nextLine();
	               int ones=0, tens=0, hun=0;

	               if(input.endsWith("one"))
	                       ones = 1;
	               if(input.endsWith("two"))
	                       ones = 2;
	               if(input.endsWith("three"))
	                       ones = 3;
	               if(input.endsWith("four"))
	                       ones = 4;
	               if(input.endsWith("five"))
	                       ones = 5;
	               if(input.endsWith("six"))
	                       ones = 6;
	               if(input.endsWith("seven"))
	                       ones = 7;
	               if(input.endsWith("eight"))
	                       ones = 8;
	               if(input.endsWith("nine"))
	                       ones = 9;

	               if(input.endsWith("eleven"))
	                       ones = 11;
	               if(input.contains("twelve"))
	                       ones = 12;
	               if(input.contains("thirteen"))
	                       ones = 13;
	               if(input.contains("fourteen"))
	                       ones = 14;
	               if(input.contains("fifteen"))
	                       ones = 15;
	               if(input.contains("sixteen"))
	                       ones = 16;
	               if(input.contains("seventeen"))
	                       ones = 17;
	               if(input.contains("eighteen"))
	                       ones = 18;
	               if(input.endsWith("nineteen"))
	                       ones = 19;

	               if(input.contains("twenty"))
	                       tens = 20;
	               if(input.contains("thirty"))
	                       tens = 30;
	               if(input.contains("forty"))
	                       tens = 40;
	               if(input.contains("fifty"))
	                       tens = 50;
	               if(input.contains("sixty"))
	                       tens = 60;
	               if(input.contains("seventy"))
	                       tens = 70;
	               if(input.contains("eighty"))
	                       tens = 80;
	               if(input.contains("ninety"))
	                       tens = 90;

	               if(input.contains("one hundred"))
	                       hun = 100;
	               if(input.contains("two hundred"))
	                       hun = 200;
	               if(input.contains("three hundred"))
	                       hun = 300;
	               if(input.contains("four hundred"))
	                       hun = 400;
	               if(input.contains("five hundred"))
	                       hun = 500;
	               if(input.contains("six hundred"))
	                       hun = 600;
	               if(input.contains("seven hundred"))
	                       hun = 700;
	               if(input.contains("eight hundred"))
	                       hun = 800;
	               if(input.contains("nine hundred"))
	                       hun = 900;

	               System.out.print(hun + tens + ones);
	       }
}

